<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">


<title>停车一道通</title>
<script  type="text/javascript" src="../../resource/js/zepto.min.js"></script>
<link rel="stylesheet" href="../../resource/frozen/css/frozen.css">
<link rel="stylesheet" href="../../resource/frozen/css/demo.css">
 
 <link rel="stylesheet" type="text/css" href="../../resource/css/pulltofresh.css" media="all" />
 
 <script type="text/javascript" src="../../resource/js/iscroll.js"></script>
 <script src="../../resource/frozen/js/frozen.js"></script>
 <script src="../../resource/js/result.js"></script>
<script src="../../resource/js/date.js"></script>
<script src="../../resource/js/common.js"></script>
<script src="../../resource/js/template.js"></script>
<script src="../../resource/js/pageTemplate.js"></script>
<script src="../../resource/js/phoneTip.js"></script>

<script src="../../resource/js/pulltofresh.js"></script>
</head>
<body onload="checkCookie()">
<div>

	<header class="ui-header ui-header-positive ui-border-b">
	    <i class="ui-icon-return" onclick="history.back()"></i><h1>消费记录</h1><!-- <button class="ui-btn" onclick="index()">首页</button> -->
	</header>	
	
	<div id="wrapper">
		<div id="scroller">
			<div id="pullDown">
          				<p  style="margin:0 auto;width:200px;"><span class="pullDownIcon"></span><span class="pullDownLabel">下拉可以刷新</span></p>
          				<p  style="margin:0 auto;width:200px;"><span id="refreshTime"></span></p>
			</div>
			<div>         
               <table class="ui-table ui-border-tb">
                   <thead>
                   <tr><th>停车场</th><th>时间</th><th>金额</th></tr>
                   </thead>
					<tbody id="loadContent">
					<script type="text/html" id="loadTemp">
					{{if data.length>0}}
                   	{{each data as dto}}
                   	<tr>
						<td>
   						{{dto.parkName}}
   						</td>
   						<td>
   						{{dto.inTime}}
   						</td>
   						<td>{{dto.needPay}}</td>
   					</tr>
   					{{/each}}
					{{else}}
					<tr><td colspan="3" style="color:#F54F12"> 暂无记录</td></tr>
				 	{{/if}}
					<input type="hidden" name="totalPage"  id="totalPage" value="{{page.totalPage}}">
					</script>
                   </tbody>
               </table>
       			<div id="pullUp" style="display:none;">
       				<span class="pullUpIcon"></span><span class="pullUpLabel"></span>
       			</div>               
	       </div>
		</div>
	</div>
</div>

<script type="text/javascript">

function onBridgeReady() {
	WeixinJSBridge.call('hideOptionMenu');
}
if (typeof WeixinJSBridge == "undefined") {
	if (document.addEventListener) {
		document.addEventListener('WeixinJSBridgeReady', onBridgeReady,
				false);
	} else if (document.attachEvent) {
		document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
		document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	}
} else {
	onBridgeReady();
}

function index(){
	location.href="/ydtu/weixin/index.htm";
}
var today=GetDateStr(0);
var yestoday=GetDateStr(-1);
var yesyestoday=GetDateStr(-2);

function getList(){
	var html;
	$.ajax({
		type: "post",
		url:linkPre+"/ydtu/tparkinout/getList.htm",
		data:getPage(), 
		dataType:"json",
		async: false,
		success:function(data){
			checkResult_weixin(data.result);
			if(data.result == SUCCESS){
				for(var i=0;i<data.data.length;i++){
					if(data.data[i].inTime.substring(0,10)==today){
						data.data[i].inTime="今天"+data.data[i].inTime.substring(11,16);
					}
					else if(data.data[i].inTime.substring(0,10)==yestoday){
						data.data[i].inTime="昨天"+data.data[i].inTime.substring(11,16);
					}
					else if(data.data[i].inTime.substring(0,10)==yesyestoday){
						data.data[i].inTime="前天"+data.data[i].inTime.substring(11,16);
					}
					else{
						data.data[i].inTime=data.data[i].inTime.substring(0,10);
					}
				}
				html = template("loadTemp", data);
			}
		}
	})
	return html;
}
function setPage(dir){
	if(refreshPage(dir)){
		return getList();
	}else{
		return "";
	}	
}
</script>
</body>
</html>